{layout name="layout" /}
<div class="page">
<nav class="bar bar-tab">
<a class="tab-item" href="javascript:;" onclick="window.location.href='/'"><span class="icon icon-home"></span><span class="tab-label">竞赛首页</span></a>
<a class="tab-item" href="javascript:;" onclick="window.location.href='{$www_url}{:url('webapp/plusexam/index')}'"><span class="icon icon-edit"></span><span class="tab-label">继续竞赛</span></a>
<a class="tab-item active" href="javascript:;"  onclick="window.location.href='{$www_url}{:url('webapp/plusexam/history')}'"><span class="icon icon-message"></span><span class="tab-label">我的成绩</span></a>
</nav>
<div class="content"><div id="TplList"></div></div></div>
<script id="Tpl" type="text/html">
{{# for(var i = 0, len = d.list.length; i < len; i++){ }}
<div class="card">
  <div class="card-header"><span>{{d.list[i].name}}</span><span class="more">得:{{d.list[i].score}}分</span></div>
  <div class="card-footer">{{d.list[i].create_time}} 至 {{d.list[i].update_time}}</div>
</div>
{{# } }}
</script>
<script id="Error" type="text/html">
<div class="page_msg">
    <div class="icon_area"><i class="icon_msg warn">!</i></div>
    <div class="text_area">{{d.message}}</div>
</div>
</script>
<style type="text/css">
  .red{color: #FF0000;padding: 0rem 0.2rem;}
.page_msg{padding:75px 15px 0;text-align:center}
.page_msg h2,.h2{font-size:18px;font-weight:400;font-style:normal}
.icon_area{margin-bottom:19px}
.text_area{margin-bottom:25px}
.text_area .title{margin-bottom:12px}
.icon_msg{width:100px;height:100px;vertical-align:middle;display:inline-block;border-radius:50%;-moz-border-radius:50%;-webkit-border-radius:50%}
.icon_msg.warn{background-color:#f86161;color:#fff;font-size:60px;font-style:normal}
</style>
<script type="text/javascript">
function loadscript(){
LazyLoad.css('/webview/light/css/icon.css');
LazyLoad.css('/webview/css/app.css');
LazyLoad.js(['/webview/jquery.2.1.4.js','/webview/light/js/light7.js','/webview/lib/laytpl.js'],function (){
    $.init();
    $.get("{:url('webapp/Account/isAppLogin')}",function(data){
      if(data.code == 1){
         islogin(data.message)
      }
    });
    $.getJSON("{:url('webapp/plusexam/history_api')}",function(data) {
        if(data.code == 0){
          var data = {"list":data.data};
          var gettpl = $("#Tpl").html();
          laytpl(gettpl).render(data,function(html){$("#TplList").html(html);});
        }else{
          data = data;gettpl = $("#Error").html();
          laytpl(gettpl).render(data,function(html){$("#TplList").html(html);}); 
        }
    });
})}
setTimeout(loadscript,10);
function islogin(message){
    $.alert(message, function () {window.location.href="{:url('webapp/Account/index')}";});
}
</script>